package com.example.scrawldemo.base;

import android.app.Application;

import com.qiniu.android.common.AutoZone;
import com.qiniu.android.storage.Configuration;
import com.qiniu.android.storage.UploadManager;


import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;


/**
 *
 * @author 椹厠鐨勮礉澹�
 * @data
 */

public class BaseApplication extends Application {

    private static BaseApplication mContext;

    public static UploadManager getUploadManager() {
        return uploadManager;
    }

    public void setUploadManager(UploadManager uploadManager) {
        this.uploadManager = uploadManager;
    }

    static   UploadManager uploadManager;
    //  
    public static BaseApplication getInstance() {
        return mContext;

    }
    public static List<?> getImages() {
        return images;
    }

    public static void setImages(List<?> images) {
        BaseApplication.images = images;
    }

    public static List<?> images=new ArrayList<>();
    @Override
    public void onCreate() {
        super.onCreate();
        mContext = this;
        qieniu();
//        getokhttp();



    }

//    public void getokhttp() {
//        OkHttpClient okHttpClient = new OkHttpClient.Builder()
////                .addInterceptor(new LoggerInterceptor("TAG"))
//                .connectTimeout(30000L, TimeUnit.MILLISECONDS)
//                .readTimeout(30000L, TimeUnit.MILLISECONDS)
//                //其他配置
//                .build();
//
//        OkHttpUtils.initClient(okHttpClient);
//    }


    public void  qieniu(){



        Configuration config = new Configuration.Builder()
                .chunkSize(256 * 1024)  //分片上传时，每片的大小。 默认256K
                .putThreshhold(512 * 1024)  // 启用分片上传阀值。默认512K
                .connectTimeout(10) // 链接超时。默认10秒
                .responseTimeout(60) // 服务器响应超时。默认60秒
                .recorder(null)  // recorder分片上传时，已上传片记录器。默认null
                .recorder(null, null)  // keyGen 分片上传时，生成标识符，用于片记录器区分是那个文件的上传记录
                .zone(AutoZone.autoZone)
                .build();
       uploadManager = new UploadManager(config);
    }
}
